package com.yellowpage.wf.service;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.yellowpage.white.common.PageRender;
import com.yellowpage.white.dao.QueryAssistantSQL;
import com.yellowpage.white.service.BaseServiceImpl;
import com.yellowpage.wf.dao.NodeContextInstanceDao;
import com.yellowpage.wf.data.NodeContextInstance;

public class NodeContextInstanceServiceImpl extends BaseServiceImpl implements NodeContextInstanceService {
	  private NodeContextInstanceDao nodeContextInstanceDao;
	
	  public void setNodeContextInstanceDao(NodeContextInstanceDao nodeContextInstanceDao) {
		  this.nodeContextInstanceDao = nodeContextInstanceDao;
	  }
	
	
	  /* White generate Method */ 
	  public List<Map> getNodeContextVersion(Long nodeId,Long nodeContextId){
			String sql = "select max(wnci.version) as version from wf_node_context_instance wnci where " +
					" wnci.workflow_node_instance_id = "+nodeId.toString()+
					" and wnci.node_context_id = "+nodeContextId.toString();

			QueryAssistantSQL sqlAssistant = baseDao.newQueryAssistantSQL(sql);
			List<Map> resultList = this.baseDao.query(sqlAssistant, new HashMap());
			return resultList;
		}
	  public void saveNodeContextInstance(NodeContextInstance nodeContextInstance)
	  {
		  nodeContextInstanceDao.save(nodeContextInstance);
	  }
}	